//
//  VC2PageControl.swift
//  ChapterAll
//
//  Created by Kevin on 2020/4/22.
//  Copyright © 2020 Kevin. All rights reserved.
//

import UIKit

class VC2PageControl: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        let page = UIPageControl(frame: CGRect(x: 20, y: 200, width: 200, height: 30))
        page.numberOfPages = 8
        page.currentPageIndicatorTintColor = UIColor.blue
        view.addSubview(page)
        
        page.addTarget(self, action: #selector(clickPageIndex(ui:)), for: .valueChanged)
    }
    
    @objc func clickPageIndex(ui:UIPageControl) -> Void {
        print("\(ui.currentPage)")
    }
}
